<template>
  <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose">
    <el-sub-menu v-for="userMenu" :index="1" :key="id">
      <template #title>
        <el-icon><location /></el-icon>
        <span>基础属性</span>
      </template>
      <el-menu-item-group title="Group One">
        <el-menu-item index="1-1">item one</el-menu-item>
        <el-menu-item index="1-2">item two</el-menu-item>
      </el-menu-item-group>
      <el-menu-item-group title="Group Two">
        <el-menu-item index="1-3">item three</el-menu-item>
      </el-menu-item-group>
      <el-sub-menu index="1-4">
        <template #title>item four</template>
        <el-menu-item index="1-4-1">item one</el-menu-item>
      </el-sub-menu>
    </el-sub-menu>
    <el-menu-item index="2">
      <el-icon><icon-menu /></el-icon>
      <span>Navigator Two</span>
    </el-menu-item>
    <el-menu-item index="3" disabled>
      <el-icon><document /></el-icon>
      <span>Navigator Three</span>
    </el-menu-item>
    <el-menu-item index="4">
      <el-icon><setting /></el-icon>
      <span>Navigator Four</span>
    </el-menu-item>
  </el-menu>
</template>

<script setup>
import { ref } from "vue";

let userMenu = ref([
  {
    id: "1",
    name: "用户权限",
    path: "/authority",
    icon: "icon-shouquan",
    children: [
      {
        id: "1-1",
        name: "用户管理",
        path: "/system/user",
        icon: "icon-renyuan",
      },
      {
        id: "1-2",
        name: "角色管理",
        path: "/system/role",
        icon: "icon-jiaose",
      },
      {
        id: "1-3",
        name: "权限管理",
        path: "/system/permission",
        icon: "icon-shenpi",
      },
      {
        id: "1-4",
        name: "群组管理",
        path: "/system/group",
        icon: "icon-qunzu",
      },
    ],
  },
  {
    id: "3",
    name: "设备管理",
    path: "/device/manager",
    icon: "icon-shebei",
    children: [
      {
        id: "3-1",
        name: "产品管理",
        path: "/device/product",
        icon: "icon-chanpinmobanguanli",
      },
      {
        id: "3-2",
        name: "设备管理",
        path: "/device/device",
        icon: "icon-shebei1",
      },
      {
        id: "3-3",
        name: "OTA升级",
        path: "/device/ota",
        icon: "icon-shebei1",
      },
      {
        id: "3-4",
        name: "升级任务",
        path: "/device/ota/task",
        icon: "icon-shebei1",
      },
      {
        id: "3-5",
        name: "远程终端",
        path: "/device/terminal",
        icon: "icon-shebei1",
      },
    ],
  },
]);
</script>
